﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kristall.Engine;

namespace Kristall.Editor.Commands
{
    public class SetLayerDepthCommand : ICommand
    {
        public string Name
        {
            get { return "Set Layer Depth"; }
        }

        Animatable _animation;
        float oldLayerDepth;
        float newLayerDepth;

        public SetLayerDepthCommand(Animatable animation, float layerDepth)
        {
            _animation = animation;
            newLayerDepth = layerDepth;
        }

        public bool Execute()
        {
            if (_animation != null)
            {
                _animation.LayerDepth = newLayerDepth;
                return true;
            }
            return false;
        }

        public bool Undo()
        {
            if (_animation != null)
            {
                _animation.LayerDepth = oldLayerDepth;
                return true;
            }
            return false;
        }
    }
}
